﻿#define _CRT_SECURE_NO_WARNINGS 1

#include"contact.h"
void menu()
{
	printf("*******************************\n");
	printf("********1.add      2.del*******\n");
	printf("********3.search   4.modify****\n");
	printf("********5.show     6.sort******\n");
	printf("**********   7.clear***********\n");
	printf("*********    0.exit************\n");
	printf("*******************************\n");
}
void test()
{
	int input = 0;
	//定义通讯录
	Contact con;
	InitContact(&con);
	do
	{
		menu();//打印菜单
		printf("请选择：");
		scanf("%d", &input);
		switch (input)
		{ 
		case Add:
			AddContact(&con);
			break;
		case Del:
			DelContact(&con);
			break;
		case Search:
			SearchContact(&con);
			break;
		case Modify:
			ModifyContact(&con);
			break;
		case Show:
			ShowContact(&con);
			break;
		case Sort:
			SortContact(&con);
			break;
		case Clear:
			ClearContact(&con);
			break;
		case Exit:
			printf("退出通讯录\n");
			break;
		default:
			printf("选择错误，请重新选择\n");
			break;
		}
	} while (input);
}
int main()
{
	test();
	return 0;
}